package com.chenwut.test1;

import java.util.Scanner;


public class Main6 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] times = new int[n];
        for (int i = 0; i < n; i++) {
            times[i] = sc.nextInt();
        }
        int t = sc.nextInt();
        int[] indices = new int[n];  // 记录排序前的位置
        for (int i = 0; i < n; i++) {
            indices[i] = i;
        }
        // 使用冒泡排序同时对 times 和 indices 进行排序
        for (int i = 0; i < n - 1; i++) {
            for (int j = 0; j < n - 1 - i; j++) {
                if (times[j] > times[j + 1]) {
                    int temp = times[j];
                    times[j] = times[j + 1];
                    times[j + 1] = temp;
                    temp = indices[j];
                    indices[j] = indices[j + 1];
                    indices[j + 1] = temp;
                }
            }
        }
        int count = 0;
        int oddCount = 0;
        for (int i = 0; i < n && t >= times[i]; i++) {
            t -= times[i];
            count++;
            if (indices[i] % 2 == 0) {
                oddCount++;
            }
        }
        System.out.println(count + " " + oddCount);
    }
}
